#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define endl "\n";
typedef long long int ll;
using namespace __gnu_pbds;
template <class type1>
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
const long long INF=1e18;
const int32_t MM=998244353;
const int N=1e7+5;
const int32_t M=1e9+7;
ll __lcm(ll a,ll b){return (a*b)/__gcd(a,b);}
const ll MOD = 1e9 + 7;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll q;
cin>>q;
map<string,ll>m;
while(q--){
char c;
cin>>c;
ll num;
cin>>num;
string s=to_string(num);
string temp="";
for(int i=0;i<s.size();i++){
int curr=s[i]-'0';
curr%=2;
char cc=(curr+'0');
temp+=cc;
}
string temp2="";
ll cnt=temp.size();
while(cnt<18){
temp2+='0';
cnt++;
}
temp=temp2+temp;
//cout<<temp<<endl;
if(c=='+'){
m[temp]++;
}
else if(c=='-'){
m[temp]--;
}
else{
cout<<m[temp]<<endl;
}
}
return 0;
}
903C - Boxes Packing | 887A - Div 64 |
755B - PolandBall and Game | 808B - Average Sleep Time |
1515E - Phoenix and Computers | 1552B - Running for Gold |
994A - Fingerprints | 1221C - Perfect Team |
1709C - Recover an RBS | 378A - Playing with Dice |
248B - Chilly Willy | 1709B - Also Try Minecraft |
1418A - Buying Torches | 131C - The World is a Theatre |
1696A - NIT orz | 1178D - Prime Graph |
1711D - Rain | 534A - Exam |
1472A - Cards for Friends | 315A - Sereja and Bottles |
1697C - awoo's Favorite Problem | 165A - Supercentral Point |
1493A - Anti-knapsack | 1493B - Planet Lapituletti |
747B - Mammoth's Genome Decoding | 1591C - Minimize Distance |
1182B - Plus from Picture | 1674B - Dictionary |
1426C - Increase and Copy | 520C - DNA Alignment |